﻿/*------------------------------------------------
// File Description: ErpTask DataBase Entity
// Author:			 Crane
// Create Time:		 2022-03-10 18:50:04
//------------------------------------------------*/

using System;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace IOA.MES.DataAccess.Entity
{
    /// <summary>
    /// ERP任务
    /// </summary>
    [Table(nameof(ErpTask))]
    public class ErpTask : BaseEntity
    {
        private string _code = string.Empty;
        private string _remark = string.Empty;

        #region Public Property

        ///<Summary>
        /// 任务类型
        ///</Summary>
        public Enum.ErpTaskType TaskType { get; set; }

        ///<Summary>
        /// 箱号/组件编号
        ///</Summary>
        public string Code
        {
            get { return string.IsNullOrWhiteSpace(_code) ? string.Empty : _code; }
            set { _code = value; }
        }

        ///<Summary>
        /// 状态
        ///</Summary>
        public Enum.ErpTaskStatus Status { get; set; }

        ///<Summary>
        /// 重试次数
        ///</Summary>
        public int RetryTimes { get; set; }

        ///<Summary>
        /// 最后重试时间
        ///</Summary>
        public DateTime? LastTryTime { get; set; }

        ///<Summary>
        /// 备注
        ///</Summary>
        public string Remark
        {
            get { return string.IsNullOrWhiteSpace(_remark) ? string.Empty : _remark; }
            set { _remark = value; }
        }
        #endregion
    }

    public partial class MESContext
    {
        /// <summary>
        /// 
        /// </summary>
        public virtual DbSet<ErpTask> ErpTasks { get; set; }
    }
}